<?php
  #--------------------------------------------------
  # ALL INCLUDES + STANDARD-VALUES
  #--------------------------------------------------
  include_once("include/config.inc");
  include_once("include/class.db.php5");
  $svo = new db("svoptik");

  include_once("include/global_fix_extern.inc");

  global $link_id;
  
  $banner_data = $svo->readRecordset("select * from ".$table['Sponsoren']." where sponsor_id='".$link_id."';");
  $svo->doSQL("update ".$table['Sponsoren']." set banner_click='".($banner_data['banner_click']+1)."' where sponsor_id='".$banner_data['sponsor_id']."';");
  $newUrl = $banner_data['sponsor_url'];

  $newUrl = trim($newUrl);
  if (!(strpos($newUrl, "http://") === 0 || strpos($newUrl, "https://") === 0)) {
      $newUrl = "http"
             . ($_SERVER['HTTPS'] == "on" ? "s" : "")
             . "://"
             . $_SERVER['HTTP_HOST']
             . (strpos($newUrl, "/") === 0? $newUrl : dirname($_SERVER['PHP_SELF']) . "/" . $newUrl);
  }
  header("Location: " . $newUrl);
  exit();
?>


